﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace Minestorm.Evolved.SceneObjects
{
    public class StarField
    {
        public VertexPositionTexture[] Vertices { get; private set; }
        public short[] IndexBuffer { get; private set; }
        public Texture2D Texture { get; private set; }

        public StarField(float dist, Texture2D texture)
        {
            Texture = texture;

            var width = 1280 / 2;
            var height = 720 / 2;

            Vertices = new VertexPositionTexture[]
            {
                new VertexPositionTexture(
                    new Vector3(-width,-height,-dist),
                    new Vector2(1,1)),
                new VertexPositionTexture(
                    new Vector3(width,-height,-dist),
                    new Vector2(0,1)),
                new VertexPositionTexture(
                    new Vector3(width,height,-dist),
                    new Vector2(0,0)),
                new VertexPositionTexture(
                    new Vector3(-width,height,-dist),
                    new Vector2(1,0))
            };

            IndexBuffer = new short[] { 0, 1, 2, 2, 3, 0 };
        }

        public void UnloadContent()
        {
            Texture.Dispose();
        }
    }
}
